<template>
  <div class="member-home">
      <!-- 概览 -->
      <HomeOverview />
      <!-- 收藏 -->
      <HomePanel title="我的收藏">
        <GoodsItem v-for="item in collectGoods" :key="item.id" :goods="item"/>
      </HomePanel>
      <HomePanel title="我的足迹">
        <GoodsItem v-for="goods in collectGoods" :key="goods.id" :goods="goods"/>
      </HomePanel>
      <!-- 组件 -->
      <GoodsRelevant />
      <!-- 猜你 -->
  </div>
</template>
<script>
import { defineAsyncComponent, ref } from 'vue'
// import request from '@/utils/request'
import { findCollect } from '@/api/member'
export default {
  name: 'MemberHome',
  components: {
    HomeOverview: defineAsyncComponent(() => import('./components/home-overview.vue')),
    HomePanel: defineAsyncComponent(() => import('./components/home-panel.vue')),
    GoodsRelevant: defineAsyncComponent(() => import('@/views/goods/components/goods-relevant')),
    GoodsItem: defineAsyncComponent(() => import('@/views/category/components/goods-item'))
  },
  setup () {
    const goods = {
      id: '1',
      name: '自煮火锅不排队 麦饭石不粘鸳鸯火锅',
      picture: 'https://yanxuan-item.nosdn.127.net/fcdcb840a0f5dd754bb8fd2157579012.jpg',
      desc: '清汤鲜香 红汤劲爽',
      price: '159.00'
    }
    // 调用模拟接口的接口
    // request('/my/test', 'get').then(data => {
    //   console.log(data)
    // })
    const collectGoods = ref([])
    findCollect({ page: 1, pageSize: 4, collectType: 1 }).then(data => {
      collectGoods.value = data.result.items
    })
    return { goods, collectGoods }
  }
}
</script>
<style scoped lang="less">
:deep(.xtx-carousel) .carousel-btn.prev {
  left: 5px;
}
:deep(.xtx-carousel) .carousel-btn.next {
  right: 5px;
}
</style>
